Using partial rendering layers

Partial rendering layer enables rendering only of the areas that are effectively changed compared to the previous frame. The redrawing of only the specific areas is implemented by rendering stencil mask before rendering representing the changed objects and layers. Because partial rendering uses stencil buffers, when you use stencil buffers in your application, you cannot use partial rendering.

Note that partial rendering is a tradeoff between the GPU render time and CPU evaluation time. When using partial rendering you will notice an increase in performance in your application only when the GPU render time is prohibitively long (for example, when you use complex shaders). See Partial rendering.

In order to get notifications from a scene, you need to specify also a partial rendering composer for the scene. Kanzi supports one partial rendering composer in the render tree.

Partial rendering is useful if:

Using partial rendering

Before using partial rendering make sure that:

To use partial rendering:

  1. In the Project select the Screen and in the Properties enable the Layer Render On Demand property.
  2. Right-click the Root Layer and select Create > Partial Rendering Layer.
  3. In Library right-click Composing > Composers and select Create > Partial Rendering Composer.
  4. Right-click Partial Rendering Composer and select Create > Render Pass.
  5. Select the Render Pass you just created and in the Properties in the Color Buffer disable the Clear Enabled property.
  6. In the Project place to the Partial Rendering Layer the scene to which you want to apply partial rendering.
    For example, move the Scene from the Viewport Layer to the Partial Rendering Layer.
  7. Select the scene you just moved to the Partial Rendering Layer and in the Properties set the Composer to Partial Rendering Composer.
  8. Select the Partial Rendering Layer and in the Properties set either the Layer Background Brush Color property to a solid color or the Layer Background Brush Texture to a texture you want to use as the background.
    Kanzi uses the background brush color or texture to clear the contents of the partial rendering layer. Because partial rendering layers are rendered into their own FBOs they must clear the area from the previous frame in their own framebuffers.
  9. (Optional) If you need to refresh dirty area of the screen, call kzuPartialRenderingLayerRefresh() in code.

Note that you cannot use Layer Render On Demand if the composer of one of the layers in your project has side effects on the application state. For example, when using Layer Render On Demand, a scene rendered with a render to texture composer in one viewport layer is not correctly rendered to a texture in another layer.

Known issues

Partial rendering known issues:

See also

Partial rendering

Rendering best practices

Rendering